<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    // 1、求1 + 2！ + 3！ + 4！....+20!的值
    // 	- 2！ = 2 * 1
    // 	- 3！ = 3 * 2 * 1

    let n = 1; //初始的和为1
    for (var i = 1; i <= 20; i++) {
      n = n * i;
    }
    // console.log(n);

    let num = prompt("请输入你需要求的阶乘数:")
    let count = 1; //初始的和为1
    for (var i = 1; i <= num; i++) {
      count *= i;
    }
    console.log(count);
  </script>
</body>

</html>